var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin=require('html-webpack-plugin')

module.exports = {
    mode: 'development',
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, './dist'),
        filename: 'bundle.js'
    },
    devServer: {
        contentBase:'./dist',
        hot:true,
        port:3000
    },
    plugins: [
        new webpack.NamedModulesPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new HtmlWebpackPlugin({
            template: './src/index.html',
            filename: 'index.html'
        })
    ],
    module: {
        rules: [
            {
                test:/\.css$/,
                use:['vue-style-loader','css-loader']
            }, {
                test: /\.less$/,
                use: ['vue-style-loader', 'css-loader', 'less-loader']
            },{
                test:/\.(png|svg|jpg|gif)$/,
                use:['file-loader']
            },{
                test:/\.(woff|woff2|eot|ttf|otf)$/,
                use:['file-loader']
            },{
                test:/\.js$/,
                use:['babel-loader'],
                exclude:/node_modules/
            }, {
                test: /\.vue$/,
                loader: 'vue-loader'
            },
        ]
    }
}